using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using BTSProjectWizard;

namespace BTSFIFOPatternWizard
{
	
	public class FIFOWizardPage : BTSProjectWizard.BTSWizardPage 
	{
		public override bool ProcessSymbols()
		{
			FIFOPattern f = (FIFOPattern)_fifoList.SelectedItem;
			bool valid = true;
			wizard.AddSymbol("FIFOPattern",f.Name );
            WizardFile wf = new WizardFile("BTSProjectWizard.FileGenerators.ODXFileGenerator", f.FileName);

			wizard.Info.WizardFiles.Add(wf);
            return valid;
		}

		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.ListBox _fifoList;
		private System.Windows.Forms.TextBox _description;
		private System.ComponentModel.Container components = null;

		public FIFOWizardPage()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call

		}

		
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if( components != null )
					components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FIFOWizardPage));
			this._fifoList = new System.Windows.Forms.ListBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this._description = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// _fifoList
			// 
			this._fifoList.AccessibleDescription = resources.GetString("_fifoList.AccessibleDescription");
			this._fifoList.AccessibleName = resources.GetString("_fifoList.AccessibleName");
			this._fifoList.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("_fifoList.Anchor")));
			this._fifoList.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("_fifoList.BackgroundImage")));
			this._fifoList.ColumnWidth = ((int)(resources.GetObject("_fifoList.ColumnWidth")));
			this._fifoList.Cursor = System.Windows.Forms.Cursors.IBeam;
			this._fifoList.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("_fifoList.Dock")));
			this._fifoList.Enabled = ((bool)(resources.GetObject("_fifoList.Enabled")));
			this._fifoList.Font = ((System.Drawing.Font)(resources.GetObject("_fifoList.Font")));
			this._fifoList.HorizontalExtent = ((int)(resources.GetObject("_fifoList.HorizontalExtent")));
			this._fifoList.HorizontalScrollbar = ((bool)(resources.GetObject("_fifoList.HorizontalScrollbar")));
			this._fifoList.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("_fifoList.ImeMode")));
			this._fifoList.IntegralHeight = ((bool)(resources.GetObject("_fifoList.IntegralHeight")));
			this._fifoList.ItemHeight = ((int)(resources.GetObject("_fifoList.ItemHeight")));
			this._fifoList.Location = ((System.Drawing.Point)(resources.GetObject("_fifoList.Location")));
			this._fifoList.Name = "_fifoList";
			this._fifoList.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("_fifoList.RightToLeft")));
			this._fifoList.ScrollAlwaysVisible = ((bool)(resources.GetObject("_fifoList.ScrollAlwaysVisible")));
			this._fifoList.Size = ((System.Drawing.Size)(resources.GetObject("_fifoList.Size")));
			this._fifoList.TabIndex = ((int)(resources.GetObject("_fifoList.TabIndex")));
			this._fifoList.Visible = ((bool)(resources.GetObject("_fifoList.Visible")));
			this._fifoList.SelectedIndexChanged += new System.EventHandler(this._fifoList_SelectedIndexChanged);
			// 
			// label1
			// 
			this.label1.AccessibleDescription = resources.GetString("label1.AccessibleDescription");
			this.label1.AccessibleName = resources.GetString("label1.AccessibleName");
			this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label1.Anchor")));
			this.label1.AutoSize = ((bool)(resources.GetObject("label1.AutoSize")));
			this.label1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label1.Dock")));
			this.label1.Enabled = ((bool)(resources.GetObject("label1.Enabled")));
			this.label1.Font = ((System.Drawing.Font)(resources.GetObject("label1.Font")));
			this.label1.Image = ((System.Drawing.Image)(resources.GetObject("label1.Image")));
			this.label1.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.ImageAlign")));
			this.label1.ImageIndex = ((int)(resources.GetObject("label1.ImageIndex")));
			this.label1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label1.ImeMode")));
			this.label1.Location = ((System.Drawing.Point)(resources.GetObject("label1.Location")));
			this.label1.Name = "label1";
			this.label1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label1.RightToLeft")));
			this.label1.Size = ((System.Drawing.Size)(resources.GetObject("label1.Size")));
			this.label1.TabIndex = ((int)(resources.GetObject("label1.TabIndex")));
			this.label1.Text = resources.GetString("label1.Text");
			this.label1.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.TextAlign")));
			this.label1.Visible = ((bool)(resources.GetObject("label1.Visible")));
			this.label1.Click += new System.EventHandler(this.label1_Click);
			// 
			// label2
			// 
			this.label2.AccessibleDescription = resources.GetString("label2.AccessibleDescription");
			this.label2.AccessibleName = resources.GetString("label2.AccessibleName");
			this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label2.Anchor")));
			this.label2.AutoSize = ((bool)(resources.GetObject("label2.AutoSize")));
			this.label2.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label2.Dock")));
			this.label2.Enabled = ((bool)(resources.GetObject("label2.Enabled")));
			this.label2.Font = ((System.Drawing.Font)(resources.GetObject("label2.Font")));
			this.label2.Image = ((System.Drawing.Image)(resources.GetObject("label2.Image")));
			this.label2.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label2.ImageAlign")));
			this.label2.ImageIndex = ((int)(resources.GetObject("label2.ImageIndex")));
			this.label2.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label2.ImeMode")));
			this.label2.Location = ((System.Drawing.Point)(resources.GetObject("label2.Location")));
			this.label2.Name = "label2";
			this.label2.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label2.RightToLeft")));
			this.label2.Size = ((System.Drawing.Size)(resources.GetObject("label2.Size")));
			this.label2.TabIndex = ((int)(resources.GetObject("label2.TabIndex")));
			this.label2.Text = resources.GetString("label2.Text");
			this.label2.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label2.TextAlign")));
			this.label2.Visible = ((bool)(resources.GetObject("label2.Visible")));
			// 
			// _description
			// 
			this._description.AccessibleDescription = resources.GetString("_description.AccessibleDescription");
			this._description.AccessibleName = resources.GetString("_description.AccessibleName");
			this._description.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("_description.Anchor")));
			this._description.AutoSize = ((bool)(resources.GetObject("_description.AutoSize")));
			this._description.BackColor = System.Drawing.SystemColors.Control;
			this._description.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("_description.BackgroundImage")));
			this._description.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("_description.Dock")));
			this._description.Enabled = ((bool)(resources.GetObject("_description.Enabled")));
			this._description.Font = ((System.Drawing.Font)(resources.GetObject("_description.Font")));
			this._description.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("_description.ImeMode")));
			this._description.Location = ((System.Drawing.Point)(resources.GetObject("_description.Location")));
			this._description.MaxLength = ((int)(resources.GetObject("_description.MaxLength")));
			this._description.Multiline = ((bool)(resources.GetObject("_description.Multiline")));
			this._description.Name = "_description";
			this._description.PasswordChar = ((char)(resources.GetObject("_description.PasswordChar")));
			this._description.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("_description.RightToLeft")));
			this._description.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("_description.ScrollBars")));
			this._description.Size = ((System.Drawing.Size)(resources.GetObject("_description.Size")));
			this._description.TabIndex = ((int)(resources.GetObject("_description.TabIndex")));
			this._description.Text = resources.GetString("_description.Text");
			this._description.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("_description.TextAlign")));
			this._description.Visible = ((bool)(resources.GetObject("_description.Visible")));
			this._description.WordWrap = ((bool)(resources.GetObject("_description.WordWrap")));
			// 
			// FIFOWizardPage
			// 
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
			this.AccessibleName = resources.GetString("$this.AccessibleName");
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.Controls.Add(this._description);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this._fifoList);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.Name = "FIFOWizardPage";
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
			this.Size = ((System.Drawing.Size)(resources.GetObject("$this.Size")));
			this.Load += new System.EventHandler(this.FIFOWizardPage_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void label1_Click(object sender, System.EventArgs e)
		{
				
		}

		private void FIFOWizardPage_Load(object sender, System.EventArgs e)
		{
			FIFOPattern f = new FIFOPattern("Timeout termination","A FIFO Pattern that terminates after a specificed amount of time","FIFOControlledTimeout.odx");
			_fifoList.Items.Add(f);
			f = new FIFOPattern("Count termination","A FIFO Pattern that terminates after a specificed number of messages are processed","FIFOControllerCount.odx");
			_fifoList.Items.Add(f);
			f = new FIFOPattern("Command termination","A FIFO Pattern that terminates after receiving a termination message","FIFOCommandControlled.odx");
			_fifoList.Items.Add(f);
			
			
			
			_fifoList.SelectedIndex=0;
				
		}

		private void _fifoList_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			FIFOPattern f = (FIFOPattern)_fifoList.SelectedItem;
			_description.Text = f.Description;
		}


	}
	public class FIFOPattern
	{
		public FIFOPattern():this("foo","bar","foo.odx")
		{
		}
		public FIFOPattern(string name,string description,string fn)
		{
			Name = name;
			Description = description;
			FileName = fn;
		}
		public string Name
		{
			get{return _Name;}
			set{_Name=value;}
		}
		string _Name;
		string _Description;
		string _FileName;
		public string FileName
		{
			get{return _FileName;}
			set{_FileName=value;}
		}
		public override string ToString()
		{
			return Name;
		}

		public string Description
		{
			get{return _Description;}
			set{_Description = value;}
		}
	}
}
